<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="../../../js/jquery.js" type="text/javascript" charset="utf-8"></script>
    <script src="//at.alicdn.com/t/font_2896317_ug7054uzl4l.js"></script>
    <link rel="stylesheet" href="./contribute.css">
    <link rel="stylesheet" type="text/css" href="../../../css/public.css">
    <title>Document</title>
</head>

<body>
    <header id="header"></header>
    <section id="wrap">
        <section class="wrap-center">
            <div class="wrap-center-top">投稿</div>
            <div class="wrap-center-second">描述你的需求</div>
            <div class="wrap-center-third">
                <div style="font-size: 18px;" class="third-left">科目</div>
                <select name="" id="subject">
                    <option value="">日常口语</option>
                    <option value="">旅游口语</option>
                    <option value="">商务汉语</option>
                    <option value="">儿童汉语</option>
                    <option value="">HSK</option>
                    <option value="">BCT</option>
                    <option value="">YCT</option>
                    <option value="">TOCFL</option>
                    <option value="">发音特训</option>
                    <option value="">汉语语法</option>
                    <option value="">汉语写作</option>
                    <option value="">中国文学</option>
                    <option value="">汉语翻译</option>
                    <option value="">台湾华语</option>
                    <option value="">粤语</option>
                    <option value="">SAT</option>
                    <option value="">AP</option>
                </select>
            </div>
            <div class="wrap-center-third">
                <div style="font-size: 18px;" class="third-left">标题</div>
                <input class="wrap-center-third-title-input" type="text" id="title">
            </div>
            <div class="wrap-center-third" style="align-items: flex-start;">
                <div style="font-size: 18px;" class="third-left">需求</div>
                <div class="edit" contenteditable="true"></div>
            </div>
            <div class="wrap-center-third">
                <div style="font-size: 18px;" class="third-left">课程单价</div>
                <div style="display: flex;align-items: center;width: 510px;justify-content: space-between;">
                    <input class="min-input" type="number" />
                    <div class="line"></div>
                    <input class="max-input" type="number" />
                </div>
            </div>
            <div style="margin-top: 20px;margin-left: 26%;color: #8B8B8B;">1200名老师适合您的选择</div>
            <div style="margin-top: 27px;margin-left: 26%;font-size: 16px;">联系方式</div>
            <div class="wrap-center-third" style="align-items: flex-start;">
                <div style="font-size: 18px;" class="third-left">名字</div>
                <input class="wrap-center-third-title-input" type="text" id="fname">
            </div>
            <div class="wrap-center-third" style="align-items: flex-start;">
                <div style="font-size: 18px;" class="third-left">邮件</div>
                <input class="wrap-center-third-title-input" type="email" id="email">
            </div>
            <div style="margin-top: 27px;margin-left: 26%;font-size: 16px;color: #8B8B8B;">By clicking Save and
                continue, you agree to CLO’s Terms of Service and Privacy Policy</div>
            <div class="upload">提交</div>
        </section>
    </section>
    <footer id="footer"></footer>
</body>

</html>
<script src="../../../js/public.js"></script>
<script src="../../../js/dream-msg.min.js"></script>
<script type="module">
    productheader('header', 4);
    $(".title-right-bar").css("border", "none");
    $(".loginin").hide();
    $(".title-bar").empty()


    let tem = `<a href=" /views/teacher/teachers.html" id="students">寻找老师</a>`;

    $(".title-bar").append(tem);
    $("#students").addClass("stuss");
    $("#sp2").css("padding-left", "0px");

    let apis = `<a href="/views/question/question.html"><i class="iconfont icon-xinxi "></i></a>
	<i class="iconfont icon-morentouxiang" style="font-size: 25px;color: #BDBDBD;margin-left: 16px;"></i>
	`

    $(".left-bar").empty("#qweww").append(apis)
    productfooter('footer', 4)
    $('.upload').click(async function () {

        if (!$('#title').val()) {
            Dreamer.warning("请填写标题！", 2000);
        } else if (!$('.edit').html()) {
            Dreamer.warning("请填写需求！", 2000);
        } else if (!$('.min-input').val()) {
            Dreamer.warning("请填写起始价格！", 2000);
        } else if (!$('.max-input').val()) {
            Dreamer.warning("请填写结束价格！", 2000);
        } else if (!$('#fname').val()) {
            Dreamer.warning("请填写名字！", 2000);
        } else if (emailtest($('#email').val()) == false) {
            Dreamer.warning("请填写邮箱！", 2000);
        } else {
            let params = {
                "promulgationpersonid": localStorage.getItem('user_Id'),
                "promulgationcontent": $('.edit').html(),
                "startmoney": parseInt($('.min-input').val()),
                "createtime": getDate(),
                "state": 1,
                'subject': $('#subject option:selected').html(),
                "title": $('#title').val(),
                "endmoney": parseInt($('.max-input').val()),
                "name": $('#fname').val(),
                "mail": $('#email').val(),
            }

            let res = await ajax('student_issue_task', params, 'post')

            if (res.code == 200) {
                Dreamer.info('提交成功', 2000);
                window.location.href = '/views/findTeacher/student/answer.html'
            } else {
                Dreamer.warning('提交失败', 2000);
            }
        }
    })
</script>
<style>
    .stuss {

        margin-left: 16px;
        padding: 4px 10px;
        background-color: #5587EC;
        border-radius: 6px;
        color: #fff;
        transform: scale(0.90);

    }
</style>